<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>

<OBJECT id=MSComm1  CLASSID="clsid:648A5600-2C6E-101B-82B6-000000000014" >
    <PARAM   NAME="CommPort"   VALUE="2"/>
    <PARAM   NAME="DataBits"   VALUE="8"/>
    <PARAM   NAME="StopBits"   VALUE="1"/>
    <PARAM   NAME="BaudRate"   VALUE="9600"/>
    <PARAM   NAME="Settings"   VALUE="9600,N,8,1"/>

    <PARAM   NAME="RTSEnable"       VALUE="1"/>
    <PARAM   NAME="DTREnable"       VALUE="1"/>
    <PARAM   NAME="Handshaking"     VALUE="0"/>
    <PARAM   NAME="NullDiscard"     VALUE="0"/>
    <PARAM   NAME="ParityReplace"   VALUE="?"/>

    <PARAM   NAME="EOFEnable"   VALUE="0"/>
    <PARAM   NAME="InputMode"   VALUE="0"/>
    <PARAM   NAME="InBufferSize"   VALUE="1024"/>
    <PARAM   NAME="InputLen"   VALUE="0"/>
    <PARAM   NAME="OutBufferSize"   VALUE="512"/>

    <PARAM   NAME="SThreshold"   VALUE="0"/>
    <PARAM   NAME="RThreshold"   VALUE="1"/>

</OBJECT>
<script src="js/ComPort.js" type="text/javascript"></script>
<script>

    var com;

    function initActiveX() {
        // tcom = getobj();
        // if(tcom!=null){
        //     alert(tcom.ComList);
        // }else{
        //     alert("tcom is null");
        // }
        //
        // alert(tcom);
        // window.tcom = tcom;

        // com = new ComPort("tcom_OB");
        // com.open(2);
        // alert(com.comList());
        // com.send("Hello,World");

        alert("aaa");
        try{
            var msComm = new ActiveXObject("MSCOMMLib.MSComm.1");
            alert(msComm);
            alert("init success");
        }catch (e) {
            console.log(e);
            alert(e);
        }
    }
</script>
<body>

    <input type="button" onclick="initActiveX()" value="initActiveX">

</body>
</html>